SET(TL_TINYXML_FOUND 0)

IF(UNIX)
    SET(TL_TINYXML_INCLUDE_SEARCHPATH /usr/include/tinyxml /usr/local/include/tinyxml)
    ELSEIF(WIN32)
    SET(TL_TINYXML_INCLUDE_SEARCHPATH $ENV{TL_INCLUDE_PATH})
ENDIF(UNIX)

SET(TL_TINYXML_LIBRARY_NAME tinyxml)
SET(TL_TINYXML_LIBRARY_DIR CACHE PATH "Semi-colon separated list of paths to search for an external tinyxml library")
MARK_AS_ADVANCED(TL_TINYXML_LIBRARY_DIR)

FIND_PATH(TL_TINYXML_INCLUDE_DIR
    tinyxml.h
    PATHS ${TL_TINYXML_INCLUDE_SEARCHPATH}
    DOC "Location of the external tinyxml headers"
    )
MARK_AS_ADVANCED(TL_TINYXML_INCLUDE_DIR)

FIND_LIBRARY(TL_TINYXML_LIBRARY
    NAMES ${TL_TINYXML_LIBRARY_NAME}
    PATHS ${TL_TINYXML_LIBRARY_DIR}
    DOC "Path to the external tinyxml library"
    )
MARK_AS_ADVANCED(TL_TINYXML_LIBRARY)


STRING(COMPARE EQUAL "${TL_TINYXML_INCLUDE_DIR}" "TL_TINYXML_INCLUDE-NOTFOUND" TL_TINYXML_INCLUDE_NOTFOUND)
STRING(COMPARE EQUAL "${TL_TINYXML_LIBRARY}" "TL_TINYXML_LIBRARY-NOTFOUND" TL_TINYXML_LIBRARY_NOTFOUND)

IF(NOT TL_TINYXML_LIBRARY_NOTFOUND AND NOT TL_TINYXML_INCLUDE_NOTFOUND)
    SET(TL_TINYXML_FOUND 1)
ENDIF(NOT TL_TINYXML_LIBRARY_NOTFOUND AND NOT TL_TINYXML_INCLUDE_NOTFOUND)

